package com.easy.yours.base.controller;

import com.easy.system.dao.BaseDao;
import com.easy.yours.base.model.BeanTest;
import com.easy.yours.base.model.CommonBean;
import com.easy.yours.biz.model.Demo;
import flexjson.JSONSerializer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created with IntelliJ IDEA.
 * User: sunguangzhu
 * Date: 13-6-18
 * Time: 下午1:05
 * To change this template use File | Settings | File Templates.
 */
@Controller
public class TestController {
    @Autowired
    private BaseDao<Demo> baseDao;

    @RequestMapping
    public String test() {
        String sql = " from Demo";
//        List list = this.baseDao.find(sql);
        return "index";
    }

    @ResponseBody
    @RequestMapping
    public String getBean() {
        CommonBean commonBean = new CommonBean();
        BeanTest beanTest = new BeanTest();
        beanTest.setId(12l);
        beanTest.setName("ceshi");
        commonBean.setData(new JSONSerializer().exclude("*.class").serialize(beanTest));
        return new JSONSerializer().exclude("*.class").serialize(commonBean).toString();
    }

    public static void main(String args[]) throws Exception {


    }
}
